home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 4 / Windows 6-Pak (InfoMagic) (Disc 4) (1999).ISO / Text-Chat-Scripts / pp-320m.exe / pp300 / r-misc.mrc < prev    next >
Text File  |  1998-08-30  |  27KB  |  583 lines

  1. ; -----------------------------------------------------
  2. ; Peace and Protection (by misspai)
  3. ; -----------------------------------------------------
  4. ; Miscellaneous grouped events,
  5. ; user levels, user protection,
  6. ; ban events, etc. (whatever wasn't
  7. ; big enough for it's own file)
  8. ; -----------------------------------------------------
  9. ; On join
  10. ; -----------------------------------------------------
  11. on me:1:join:#:{
  12.   set %_repjoins $remtok(%_repjoins,$chan,32)
  13.   if ($findtok(%-mirc.rejoins,$chan,32) == $null) {
  14.     .raw who $chan
  15.     set %-ial.update %-ial.update $chan
  16.     .enable #-ialupdate
  17.   }
  18.   else {
  19.     set %-mirc.rejoins $remtok(%-mirc.rejoins,$chan,32)
  20.     set %-mirc.rejoins2 $addtok(%-mirc.rejoins2,$chan,32)
  21.     .raw mode $chan
  22.   }
  23.   inc %-joining
  24.   set %-joinchans $addtok(%-joinchans,$chan,32)
  25.   unset %-namec.*
  26.   dispr-div $chan
  27. }
  28. alias _dowuh if ($right(%-uhsearch,6) == .clean) { .timer925 1 4 _dowuh | halt } | .timer925 off | if (%-willuhost == $null) halt | .raw userhost %-willuhost | set %-uhsearch %-uhsearch .group | unset %-willuhost
  29. on 1:join:#:{
  30.   if ($address == %-my.address) return
  31.   set %.file $_ppdir $+ kickstat.ini
  32.   if ($lof(%.file) > 29000) .remove %.file
  33.   elseif ((%+joinstat) && (%-clonejoin. [ $+ [ $site ] ] < 2)) {
  34.     set %.jsident $remove($gettok($address,1,64),~)
  35.     set %.scan $readini -n %.file hash $left(%.jsident,1)
  36.     if (%.scan != $null) {
  37.       set %.tok $mid(%.jsident,2,1) $+ $len(%.jsident)
  38.       if (%.tok isin %.scan) {
  39.         set %.mask $mask($fulladdress,3)
  40.         set %.data $readini -n %.file stats %.mask
  41.         if (%.data != $null) {
  42.           set %.kick $gettok(%.data,2,32) 
  43.           set %.ban $gettok(%.data,3,32) 
  44.           if ((%.kick >= %kickstat.minkick) || (%.ban >= %kickstat.minban)) {
  45.             dispr $chan You've seen %col.target $+ $nick $+  suffer %.kick kicks/ $+ %.ban kickbans (press %col.option $+ CtrlF3 for details, %col.option $+ ShiftF4 to clear)
  46.             set %-cf3 kickstat " $+ $nick $+ " %.mask
  47.             set %-last.uctcp *clrstat*
  48.             set %-last.clones " $+ $nick $+ " %.mask
  49.           }
  50.         }
  51.       }
  52.     }
  53.   }
  54.   if (%+ircop.check) {
  55.     if ($findtok(%-willuhost,$nick,32) == $null) {
  56.       set %-willuhost %-willuhost $nick
  57.       if ($_numtok(32,%-willuhost) >= 5) _dowuh
  58.       else .timer925 1 4 _dowuh
  59.     }
  60.   }
  61.   if (%+nickcolors) _nickcol $nick $address $fulladdress
  62.   if (($address == cservice@undernet.org) && (%pp.net == undernet) && (($nick == X) || ($nick == W))) { auto xpq $chan | halt }
  63.   if ($me isop $chan) {
  64.     set %.addr $maddress($fulladdress)
  65.     set %.level $level(%.addr)
  66.     if (black isin %.level) {
  67.       set %.bb.chn $_ppblk(%.addr)
  68.       if ($findtok(%.bb.chn,$chan,32) != $null) set %.bb.chn $chan
  69.       elseif (* isin %.bb.chn) set %.bb.chn *
  70.       else goto noblack
  71.       set %.bb.why %.addr $+ > $+ %.bb.chn
  72.       if (%.bb.chn == *) set %.bb.chn $_s2f(all channels)
  73.       if (%autounban.black > 0) tunban $calc(%autounban.black * 60) $chan %.addr
  74.       kb $chan %.addr $_blackmsg(Kicks,Blacklist,%.bb.chn,$nick,%.addr,$_ppblk(%.bb.why))
  75.       halt
  76.     }
  77.     if (voice isin %.level) .raw mode $chan +v $nick
  78.     if ((op isin %.level) && (nopw isin %.level)) {
  79.       set %.where %opchan. [ $+ [ %.addr ] ]
  80.       if (($findtok(%.where,$chan,32) != $null) || ($findtok(%.where,any,32) != $null)) .raw mode $chan +o $nick
  81.     }
  82.   }
  83.   :noblack
  84.   unset %.cs.num
  85.   if ($_setting(+floodpro.joinoff,$chan)) goto noclone
  86.   if (%+clonescan.theyjoin) {
  87.     if (%+clonescan.identd) set %.cs.mask $mask($fulladdress,1)
  88.     else set %.cs.mask $wildsite
  89.     set %.cs.num $ialchan(%.cs.mask,$chan,0)
  90.     if (%.cs.num > 1) {
  91.       if ((%.cs.mask == $wildsite) && ($ialchan($mask($fulladdress,1),$chan,0) == %.cs.num)) set %.cs.mask $mask($fulladdress,1)
  92.       set %-keybop.nick $nick
  93.       set %-keybop.chan $chan
  94.       set %-keybop.addr $fulladdress
  95.       set %.cs.nicks $_getnicks($chan,%.cs.mask)
  96.       set %-last.uctcp *clones*
  97.       set %-last.clones $_s2c(%.cs.nicks)
  98.       dispr $chan [[ $+ %col.info1 $+ $lower($chan) $+ ] %col.att $+ %.cs.num CLONES detected from %col.target $+ $nick $+  %col.info3 $+ ( $+ $remtok(%.cs.nicks,$nick,32) $+ ) %col.addr $+ ( $+ %.cs.mask $+ ) $_opt($nick,$fulladdress,$chan) %col.option $+ (ShiftF4 to ping the clones) 
  99.       if (($me isop $chan) && ($ulevel < 50)) {
  100.         set %.max.1 $_setting(max.clone,$chan)
  101.         set %.max.2 $_setting(warn.clone,$chan)
  102.         if ((%.max.1 > 0) && (%.cs.num >= %.max.1)) { .timer912 off | _prog.punish clone Clones %.cs.num $_s2c(%.cs.nicks) $chan %.cs.mask %.cs.mask $site | halt }
  103.         elseif ((%.max.2 > 0) && (%.cs.num >= %.max.2)) .timer912 1 3 msg $_s2c(%.cs.nicks) $_finalmsg($replace($replace($replace($replace($_getmsg(Misc,CloneWarn),&chan&,$chan),&nick&,%.cs.mask),&num&,%.cs.num),&nicks&,%.cs.nicks))
  104.       }
  105.     }
  106.   }
  107.   :noclone
  108.   if ((%+imposter.alert) && (%.cs.num < 2)) {
  109.     set %.impos *! $+ %-my.address
  110.     set %.them $mask($fulladdress,3)
  111.     if (%.them == $mask(%.impos,3)) dispr $chan [[ $+ %col.info1 $+ $lower($chan) $+ ] %col.att $+ IMPOSTER detected from %col.target $+ $nick $+  %col.addr $+ ( $+ %.them $+ ) $_opt($nick,$fulladdress,$chan)
  112.   }
  113.   _timersinc 15 -clonejoin. $+ $site
  114.   if (%-clonejoin. [ $+ [ $site ] ] < 3) {
  115.     if ((%auto-j.all != $null) || (%auto-j. [ $+ [ $chan ] ] != $null)) {
  116.       set %.cs.lvl $_setting(autoj.ulevel,$chan)
  117.       if (< isin %.cs.lvl) set %.cs.type <
  118.       elseif (> isin %.cs.lvl) set %.cs.type >
  119.       else unset %.cs.type
  120.       if (= isin %.cs.lvl) set %.cs.type %.cs.type =
  121.       set %.cs.lvl $remove($remove($remove(%.cs.lvl,=),>),<)
  122.       if ((< isin %.cs.type) && ($gettok($ulevel,1,44) < %.cs.lvl)) auto jpq $chan $nick
  123.       elseif ((> isin %.cs.type) && ($gettok($ulevel,1,44) > %.cs.lvl)) auto jpq $chan $nick
  124.       elseif ((= isin %.cs.type) && ($findtok($remove($ulevel,=),%.cs.lvl,1,44) != $null)) auto jpq $chan $nick
  125.     }
  126.     set %.+whois $false
  127.     set %.+hide $true
  128.     if (($_setting(match.chancheck,$chan) != $null) && ($me isop $chan) && ($ulevel < 50) && ($_not($_setting(+floodpro.joinoff,$chan)))) { if (%-ccwhois. [ $+ [ $nick ] ] == $null) set %.+whois $true | set %-ccwhois. [ $+ [ $nick ] ] %-ccwhois. [ $+ [ $nick ] ] $chan }
  129.     set %.dowhois $_setting(whois.onjoin,$chan)
  130.     if ((%_away.why) && ($_not(%+whois.ifaway))) set %.dowhois off
  131.     if (((%.dowhois == on) || ((op isin %.dowhois) && ($me isop $chan))) && ($ulevel < $_setting(whois.stoplvl,$chan)) && (%-waitwhois. [ $+ [ $nick ] ] == $null)) { set %.+whois $true | set %.+hide $false | set %-waitwhois. [ $+ [ $nick ] ] $chan }
  132.     if (%.+whois) {
  133.       whois " $+ $nick $+ "
  134.       if (%.+hide) set %-+hidewhois. [ $+ [ $nick ] ] $true
  135.     }
  136.   }
  137. }
  138. alias _recch {
  139.   if (($1 ison $2) && ($me isop $2)) {
  140.     if (%-ccwhois. [ $+ [ $1 ] ] == $null) { whois " $+ $1" | set %-+hidewhois. [ $+ [ $1 ] ] $true }
  141.     set %-ccwhois. [ $+ [ $1 ] ] %-ccwhois. [ $+ [ $1 ] ] $2
  142.   }
  143. }
  144. ; -----------------------------------------------------
  145. ; On ban
  146. ; -----------------------------------------------------
  147. on 1:ban:#:{
  148.   ; Save recent bans
  149.   set %_recent.ban. [ $+ [ $chan ] ] $banmask
  150.   if (($address == cservice@undernet.org) && (%pp.net == undernet) && (($nick == X) || ($nick == W))) set %.+xwban $true
  151.   else unset %.+xwban
  152.   ; Check for banning YOU
  153.   set %.b.chk $me $+ ! $+ %-my.address
  154.   if ($banmask iswm %.b.chk) {
  155.     if ($nick == $me) { dispr $chan [[ $+ %col.info1 $+ $chan $+ ] You banned yourself- Removing ban... | .raw mode $chan -b $banmask | return }
  156.     _timersinc 30 -dban-halt
  157.     if (%-dban-halt > 5) return
  158.     if ($me !isop $chan) goto noubo
  159.     if ((%.+xwban) || ($ulevel >= 50) || ($nick !ison $chan)) .raw mode $chan -b $banmask
  160.     else { .raw mode $chan -ob $nick $banmask | k $chan $nick $_finalmsg($replace($replace($_getmsg(Kicks,BanMe),&chan&,$chan),&nick&,$nick)) }
  161.     :noubo
  162.     _alert BANNED Banned from  $+ $chan $+  by  $+ $nick $+ ! (mask $banmask $+ )
  163.     disps %col.att $+ Banned from %col.target $+ $chan $+  by %col.target $+ $nick $+  (mask %col.info1 $+ $banmask $+ )
  164.     return
  165.   }
  166.   ; Display banned users, Activity.Log
  167.   if (%+showbanned) {
  168.     set %.banned $_s2cs($_getnicks($chan,$banmask))
  169.     set %-recent.bans. [ $+ [ $chan ] ] %.banned
  170.     _timersinc 20 -showban
  171.     if ((%.banned != $null) && (%-showban < 4)) disprs $chan [[ $+ %col.info1 $+ $chan $+ ] Banned- %col.info1 $+ %.banned
  172.     if ($group(#activitylog) == on) _alogban %.banned
  173.   }
  174.   elseif ($group(#activitylog) == on) _alogban users unknown
  175.   ; Skip further events if not opped
  176.   if ($me !isop $chan) return
  177.   ; Now look for protected users
  178.   set %.b.num $ialchan($banmask,$chan,0)
  179.   if (%.b.num > 0) {
  180.     :prot
  181.     if ($level($maddress($ialchan($banmask,$chan,%.b.num))) >= 75) {
  182.       _timersinc 30 -dban-halt
  183.       if (%-dban-halt > 5) return
  184.       if (($ulevel < 50) && (%.+xwban == $false) && ($nick ison $chan)) k $chan $nick $_finalmsg($replace($replace($_getmsg(Misc,ProtKick),&chan&,$chan),&nick&,$ialchan($banmask,$chan,%.b.num).nick))
  185.       .raw mode $chan -b $banmask
  186.       return
  187.     }
  188.     if ($_vd(.b.num) > 0) goto prot
  189.   }
  190.   ; Timed unbans
  191.   set %.cmd $banmask $+ $chan
  192.   if ($nick != $me) .timerTempBan [ $+ [ $replace($replace(%.cmd,*,&),?,+) ] ] off
  193.   .timerAutoUnban [ $+ [ $replace($replace(%.cmd,*,&),?,+) ] ] off
  194.   ; Automatic unbans
  195.   if ($nick == $me) set %.time %autounban.your
  196.   else set %.time %autounban.their
  197.   if (%.time > 0) tunban2 $calc(%.time * 60) $chan $banmask
  198.   :noautou
  199.   ; Filterkick on ban
  200.   if ((%s^c == ChanServ) && ($nick == Chanserv)) return
  201.   if ((%.+xwban) || (. isin $nick)) return
  202.   if (($_setting(%+filterkick.bans,$chan)) && ($nick ison $chan)) fknop $chan $banmask $_kickmsg($chan,&nick&,Banned)
  203.   ; Desynch check
  204.   if ($_setting(+floodpro.modeoff,$chan)) return
  205.   if (($_setting(%+desynch.kicks,$chan)) && ($nick !isop $chan)) {
  206.     set %.des $site $+ $chan
  207.     _timersinc 30 -desynch. $+ %.des
  208.     if (%-desynch. [ $+ [ %.des ] ] > 4) {
  209.       if ($nick !ison $chan) .raw mode $chan +b $wildsite
  210.       else k $chan $nick $_kickmsg($chan,$nick,Desynch)
  211.     }
  212.   }
  213. }
  214. ; -----------------------------------------------------
  215. ; On unban
  216. ; -----------------------------------------------------
  217. on 1:unban:#:{
  218.   set %_recent.unban. [ $+ [ $chan ] ] $banmask
  219.   set %-recent.bans. [ $+ [ $chan ] ]
  220.   ; Timed unbans
  221.   set %.cmd $banmask $+ $chan
  222.   .timerTempBan [ $+ [ $replace($replace(%.cmd,*,&),?,+) ] ] off
  223.   .timerAutoUnban [ $+ [ $replace($replace(%.cmd,*,&),?,+) ] ] off
  224.   ; Desynch check
  225.   if ($_setting(+floodpro.modeoff,$chan)) return
  226.   if ((%s^c == ChanServ) && ($nick == Chanserv)) return
  227.   if (. isin $nick) return
  228.   if (($_setting(%+desynch.kicks,$chan)) && ($nick !isop $chan)) {
  229.     set %.des $site $+ $chan
  230.     _timersinc 30 -desynch. $+ %.des
  231.     if (%-desynch. [ $+ [ %.des ] ] > 4) {
  232.       if ($nick !ison $chan) .raw mode $chan +b $wildsite
  233.       else k $chan $nick $_kickmsg($chan,$nick,Desynch)
  234.     }
  235.   }
  236. }
  237. ; -----------------------------------------------------
  238. ; On input
  239. ; -----------------------------------------------------
  240. #_inputhalt off
  241. on 1:input:*:return
  242. #_inputhalt end
  243. on 1:input:@Quick:window -c @Quick | %_timer.quick = $1- | .timer -om 1 1 % $+ _timer.quick | halt
  244. on 1:input:@Question:window -c @Question | .timer927 off | %_timer.preq = $_f2s($1-) | .timer -om 1 1 % $+ _preq.c % $+ _timer.preq | halt
  245. on 1:input:@Peace:window -c @Peace | .timer927 off | _timer924on | if ((%_+pe.req) && ($1- == $chr(160))) halt | %_timer.peace = $_f2s($1-) | .timer -om 1 1 % $+ _pe.command % $+ _timer.peace | halt
  246. on 1:input:#:{
  247.   if (($left($1,2) == //) || ($left($1,2) == /.)) return
  248.   if ((%+nick.complete.text != $true) || (n isin %nick.complete.chars) || (%nick.complete.chars == off)) goto normal
  249.   if (($left($1,1) == /) || ($len($1) == 1) || ($left($1,1) isin %nick.complete.chars) || ($left($1,1) == ")) goto normal
  250.   unset %.nc.said
  251.   if ($right($1,1) isin %nick.complete.chars) {
  252.     set %.nc.n $pos(%nick.complete.chars,$right($1,1))
  253.     set %.nc.act $right($1,1)
  254.     set %.nc.to $_lchop(1,$1)
  255.     set %.nc.said $2-
  256.     goto doit
  257.   }
  258.   set %.nc.n $len(%nick.complete.chars)
  259.   :loopc
  260.   set %.nc.act $mid(%nick.complete.chars,%.nc.n,1)
  261.   if (%.nc.act == $2) { set %.nc.to $1 | set %.nc.act $2 | goto doit }
  262.   if ((%.nc.act !isin $1) || (%.nc.act == -)) { if ($_vd(.nc.n) > 0) goto loopc | goto normal }
  263.   set %.nc.to $gettok($1,1,$asc(%.nc.act))
  264.   :doit
  265.   if ($findtok(yes no uh uhh hey um umm er err heh hehe hah haha well ok okay so wow ack look see duh doh now o oh ah ahh hi yo i and nah,%.nc.to,32) != $null) goto normal
  266.   set %.nc.to $_nickcomp(%.nc.to,$active)
  267.   if (%.nc.to != $null) {
  268.     set %.nc.msg $replace($replace($replace($_getmsg(misc,nickcomplete),&chan&,$active),&nick&,%.nc.to),&char&,%.nc.act)
  269.     if (%.nc.said == $null) { if (%.nc.act == $2) set %.nc.said $3- | else set %.nc.said $gettok($1,2-,$asc(%.nc.act)) $2- }
  270.     if (%.nc.said == $null) goto normal
  271.     if (%+cnc.on) set %.nc.said $_cncapply($_inlinenc(%.nc.said))
  272.     elseif (%+strip.from.input) set %.nc.said $_stripout($_inlinenc(%.nc.said))
  273.     else set %.nc.said $_inlinenc(%.nc.said)
  274.     if (&msg& isin %.nc.msg) set %.nc.msg $replace(%.nc.msg,&msg&,%.nc.said)
  275.     else set %.nc.msg %.nc.msg %.nc.said
  276.     say $_finalmsg(%.nc.msg)
  277.     halt
  278.   }
  279.   :normal
  280.   if (%+cnc.on) {
  281.     if ($left($1,1) == /) {
  282.       if (%+nick.complete.cmd) $_cncapplycmd($1 [ $_inlinenc($2-) ] )
  283.       else $_cncapplycmd($1-)
  284.     }
  285.     else say $_cncapply($_inlinenc($1-))
  286.     halt
  287.   }
  288.   if (%+strip.from.input) {
  289.     if ($left($1,1) == /) {
  290.       if (%+nick.complete.cmd) $_stripout($1 [ $_inlinec($2-) ] )
  291.       else $_stripout($1-)
  292.     }
  293.     else say $_stripout($_inlinenc($1-))
  294.     halt
  295.   }
  296.   if (%nick.complete.inline isin $1-) {
  297.     if ($left($1,1) != /) { say $_inlinenc($1-) | halt }
  298.     elseif (%+nick.complete.cmd) { $1 $_inlinenc($2-) | halt }
  299.   }
  300. }
  301. on 1:input:?:{
  302.   if (($left($1,2) == //) || ($left($1,2) == /.)) return
  303.   if (%+cnc.on) {
  304.     if ($left($1-,1) == /) $_cncapplycmd($1-)
  305.     else say $_cncapply($1-)
  306.     halt
  307.   }
  308.   if (%+strip.from.input) {
  309.     if ($left($1,1) == /) $_stripout($1-)
  310.     else say $_stripout($1-)
  311.     halt
  312.   }
  313. }
  314. alias -l _inlinenc {
  315.   if (($len(%nick.complete.inline) != 1) || (%nick.complete.inline !isin $1-)) return $1-
  316.   set %.search  $+ %nick.complete.inline
  317.   set %.text  $+ $_s2p($1-) $+ 
  318.   set %.s1 %.search $+ 
  319.   set %.s2 $chr(160) $+ %nick.complete.inline $+ 
  320.   set %.text $replace(%.text,%.s1,%.s2)
  321.   :loop1
  322.   set %.pos $pos(%.text,%.search)
  323.   if (%.pos == $null) return $_f2s($_p2s(%.text))
  324.   set %.bit $gettok($_rchop($_i(%.pos),%.text),1,127)
  325.   unset %.aft
  326.   :loop2 | if (($right(%.bit,1) isin `~!@#$%&*()-=+;:'",.<>/?) || ($right(%.bit,2) isin 's`s)) { set %.aft $right(%.bit,1) $+ %.aft | set %.bit $_lchop(1,%.bit) | goto loop2 }
  327.   if ($len(%.bit) > 1) set %.comp $_nickcomp(%.bit,$active) | else unset %.comp
  328.   if (%.comp != $null) set %.new $chr(160) $+ $_finalmsg($replace($replace($replace($_getmsg(misc,inlinenickc),&chan&,$active),&nick&,%.comp),&char&,%nick.complete.inline)) $+ %.aft
  329.   else set %.new $chr(160) $+ %nick.complete.inline $+ %.bit $+ %.aft
  330.   set %.old %.search $+ %.bit $+ %.aft
  331.   set %.text $replace(%.text,%.old,%.new)
  332.   goto loop1
  333. }
  334. ; -----------------------------------------------------
  335. ; Users with op access
  336. ; -----------------------------------------------------
  337. ctcp op:OPME:?:{
  338.   set %.+disphalt $true
  339.   set %.op.addr $maddress($fulladdress)
  340.   set %.op.pw %oppass. [ $+ [ %.op.addr ] ]
  341.   set %.op.chan %opchan. [ $+ [ %.op.addr ] ]
  342.   if ($findtok(%.op.chan,any,32) != $null) set %.op.chan %.op.chan $2- $_getchans
  343.   if (nopw isin $level(%.op.addr)) { unset %.op.pw | if ($2 == $null) goto doall | goto doone }
  344.   if (%.op.pw == $null) {
  345.     disps %col.target $+ $nick $+  tried to use OPME before setting a password. %col.misc $+ ( $+ $1- $+ )
  346.     _qnotice $nick A password has not been set. Use PASS to set a password.
  347.   }
  348.   elseif (($2 != %.op.pw) && ($3 != %.op.pw)) {
  349.     disps %col.target $+ $nick $+  used the wrong password for their OPME command. %col.misc $+ ( $+ $1- $+ ) %col.att $+ Ignoring CTCPs from user for 30 seconds.
  350.     _qnotice $nick Password incorrect. Ignoring CTCPs for 30 seconds.
  351.     .ignore -tu30 $wildsite
  352.   }
  353.   elseif (($3 != $null) && ($findtok(%.op.chan,$2,32) == $null) && ($findtok(%.op.chan,$3,32) == $null)) {
  354.     disps %col.target $+ $nick $+  requested ops with OPME on a channel they have no access to. %col.misc $+ ( $+ $1- $+ )
  355.     _qnotice $nick You do not have OPME access on that channel.
  356.   }
  357.   elseif ($3 == $null) {
  358.     :doall
  359.     disps %col.target $+ $nick $+  requested ops with OPME on all channels allowed. %col.misc $+ ( $+ $1- $+ )
  360.     set %.op.num $comchan($nick,0)
  361.     if (%.op.num == 0) halt
  362.     :loop
  363.     set %.op.try $comchan($nick,%.op.num)
  364.     if (($me isop %.op.try) && ($findtok(%.op.chan,%.op.try,32) != $null)) .raw mode %.op.try +o $nick
  365.     if ($_vd(.op.num) > 0) goto loop
  366.   }
  367.   else {
  368.     :doone
  369.     if ($2 == %.op.pw) set %.op.try $3
  370.     else set %.op.try $2
  371.     disps %col.target $+ $nick $+  requested ops with OPME on %col.target $+ %.op.try $+ . %col.misc $+ ( $+ $1- $+ )
  372.     if (($me isop %.op.try) && ($nick ison %.op.try)) .raw mode %.op.try +o $nick
  373.   }
  374.   halt
  375. }
  376. ctcp op:PASS:?:{
  377.   set %.+disphalt $true
  378.   set %.op.addr $maddress($fulladdress)
  379.   set %.op.pw %oppass. [ $+ [ %.op.addr ] ]
  380.   unset %.op.new
  381.   if ($2 == $null) {
  382.     disps %col.target $+ $nick $+  used PASS with no parameters. (sending usage info.)
  383.     _qnotice $nick Usage: PASS (oldpass) newpass
  384.     halt
  385.   }
  386.   if (%.op.pw == $null) set %.op.new $2
  387.   elseif ($2 == %.op.pw) set %.op.new $3
  388.   elseif ($3 == %.op.pw) set %.op.new $2
  389.   else {
  390.     disps %col.target $+ $nick $+  tried to change their PASS but gave the wrong original password. %col.misc $+ ( $+ $1- $+ ) %col.att $+ Ignoring CTCPs from user for 30 seconds.
  391.     _qnotice $nick Password incorrect. Ignoring CTCPs for 30 seconds.
  392.     .ignore -tu30 $wildsite
  393.     halt
  394.   }
  395.   if (%.op.new == $null) {
  396.     disps %col.target $+ $nick $+  used PASS with their old pass but didn't specify a new one. %col.misc $+ ( $+ $1- $+ )
  397.     _qnotice $nick You need to specify a new password along with your old one.
  398.     halt
  399.   }
  400.   disps %col.target $+ $nick $+  set their OPME password to %col.info1 $+ %.op.new $+ . %col.misc $+ ( $+ $1- $+ )
  401.   _qnotice $nick Password set to " $+ %.op.new $+ "
  402.   set %oppass. [ $+ [ %.op.addr ] ] %.op.new
  403. }
  404. ctcp op:HELP:?:{
  405.   set %.+disphalt $true
  406.   disps %col.target $+ $nick $+  requested help on OPME commands. %col.misc $+ ( $+ $1- $+ )
  407.   _qnotice $nick OPME (channel) password - Requests ops on a channel, or all valid channels if none given.
  408.   _qnotice $nick PASS (oldpass) newpass - Sets or changes your password.
  409.   halt
  410. }
  411. ; -----------------------------------------------------
  412. ; Protected users (from kicks and
  413. ; deops)
  414. ; -----------------------------------------------------
  415. on !@1:deop:#:{
  416.   set %.addr $address($opnick,5)
  417.   set %.des $gettok(%.addr,2-,64) $+ $chan
  418.   _timersinc 30 -desynch. $+ %.des 10
  419.   if (($opnick == $me) || ($opnick == $nick)) halt
  420.   if ($level($maddress(%.addr)) < 75) halt
  421.   if (($address == cservice@undernet.org) && (%pp.net == undernet) && (($nick == X) || ($nick == W))) { .raw mode $chan +o $opnick | return }
  422.   if (($nick !isop $chan) || ($level($maddress($address($nick,5))) >= 50)) { .raw mode $chan +o $opnick | return }  disp %.addr
  423.   if ((%pp.net == undernet) || (%pp.net == dalnet)) .raw mode $chan -o+o $nick $opnick
  424.   else { .raw mode $chan -o $nick | .raw mode $chan +o $opnick }
  425.   n $nick $_finalmsg($replace($replace($_getmsg(Misc,ProtDeop),&chan&,$chan),&nick&,$opnick))
  426. }
  427. on !@1:kick:#:{
  428.   if (($knick == $me) || ($knick == $nick)) halt
  429.   if ($level($maddress($address($knick,5))) < 75) halt  
  430.   set %.kicker $nick
  431.   if (($address == cservice@undernet.org) && (%pp.net == undernet) && (($nick == X) || ($nick == W))) {
  432.     if ($1 == from) set %.kicker $2
  433.     else set %.kicker $remove($remove($1,$chr(40)),$chr(41))
  434.   }
  435.   if (($level($maddress($address(%.kicker,5))) < 50) && (%.kicker ison $chan)) k $chan %.kicker $_finalmsg($replace($replace($_getmsg(Misc,ProtKick),&chan&,$chan),&nick&,$knick))
  436.   invite $knick $chan
  437. }
  438. ; -----------------------------------------------------
  439. ; Extreme DCC flood prot
  440. ; -----------------------------------------------------
  441. #extremedcc off
  442. on 1:chat:*:{
  443.   if (($nick == %_qlogin.nick) || ($nick == $me)) halt
  444.   _timersinc %extremedcc.sec _edf. $+ $nick
  445.   if (%_edf. [ $+ [ $nick ] ] > %extremedcc) {
  446.     .msg =$nick *** %extremedcc lines in %extremedcc.sec seconds : closing chat ***
  447.     disps Chat with %col.target $+ $nick $+  closed- %col.att $+ Flood of %extremedcc lines in %extremedcc.sec seconds.
  448.     close -c $nick
  449.   }
  450. }
  451. #extremedcc end
  452. ; -----------------------------------------------------
  453. ; Queryopen prot.
  454. ; -----------------------------------------------------
  455. #extremequery on
  456. on +1:open:?:if (%-extremeq > %extremequery) { _timersinc %-eqtimersec -extremeq | halt } | else _doexq
  457. on +1:action:*:?:if ($query($nick) != $nick) { if (%-extremeq > %extremequery) { _timersinc %-eqtimersec -extremeq | closemsg $nick | halt } | else _doexq }
  458. alias -l _doexq {
  459.   _timersinc %extremequery.sec -extremeq
  460.   if (%-extremeq > %extremequery) {
  461.     disps New query flood- %extremequery new query windows in %extremequery.sec seconds! All new query windows from unrecognized addresses will be ignored until flood ends.
  462.     set %-eqtimersec $calc(%extremequery.sec * 3)
  463.     _timersinc %-eqtimersec -extremeq
  464.     if (%+nickchange.flood) {
  465.       _timersinc 60 -floodchanged
  466.       if (%-floodchanged < 2) rn
  467.     }
  468.   }
  469. }
  470. #extremequery end
  471. ; -----------------------------------------------------
  472. ; Extreme notice warning
  473. ; -----------------------------------------------------
  474. #extremenotice on
  475. on +1:notice:*:?:{
  476.   _timersinc %extremenotice.sec -extremen
  477.   if (%-extremen == %extremenotice) {
  478.     window -c @Alert
  479.     window -do @Alert $_center(500,100,d) 500 100 @Close2 %font.quick
  480.     aline @Alert %col.att $+ ALERT-
  481.     aline %col.cdark @Alert  $+ If you are being flooded with notices,
  482.     aline %col.cdark @Alert  $+ press %col.att $+ CtrlF9 to ignore all notices/etc.
  483.     beep 1 1
  484.   }
  485. }
  486. #extremenotice end
  487. ; -----------------------------------------------------
  488. ; Blacklist (and on-op events)
  489. ; -----------------------------------------------------
  490. on 1:op:#:{
  491.   if ($opnick != $me) return
  492.   if ($nick == $me) dispr $chan Bouncy ops! Bouncy ops! Do it again! Wai!
  493.   _doautoopq $chan $nick
  494.   if (%+blackscan.youop) _blackscan $chan
  495.   if (%onoptopic. [ $+ [ $chan ] ] != $null) .raw topic $chan : $+ %onoptopic. [ $+ [ $chan ] ]
  496.   elseif (%stricttopic. [ $+ [ $chan ] ] != $null) .raw topic $chan : $+ %stricttopic. [ $+ [ $chan ] ]
  497.   set %.mode1 $_setting(strictmode,$chan)
  498.   set %.mode2 $_setting(onopmode,$chan)
  499.   set %.mode $gettok(%.mode1,1,32) $+ $gettok(%.mode2,1,32) $gettok(%.mode1,2-,32) $gettok(%.mode2,2-,32)
  500.   if ($remove($remove(%.mode,+),-) != $null) {
  501.     set %.modet $_fixmode($gettok(%.mode,1,32))
  502.     if (-k isin %.modet) {
  503.       if ($chan($chan).key == $null) set %.mode $remove(%.modet,-k) $gettok(%.mode,2-,32)
  504.       elseif ((+l isin %.modet) && ($pos(%.modet,+l) > $pos(%.modet,-k))) set %.mode %.modet $chan($chan).key $gettok(%.mode,2-,32)
  505.       else set %.mode %.mode $chan($chan).key
  506.     }
  507.     elseif (+k isin %.modet) if ($chan($chan).key != $null) .raw mode $chan -k $chan($chan).key
  508.     .raw mode $chan %.mode
  509.     if (k isin %.mode) .timer923 1 8 _chkkey $chan
  510.   }
  511. }
  512. alias _doautoopq {
  513.   if ($me !ison $1) halt
  514.   if ($findtok(%-ial.update,$1,32) != $null) { .timer 1 5 _doautoopq $1- | halt }
  515.   auto opq $1-
  516. }
  517. alias _blackscan {
  518.   if ($me !ison $1) halt
  519.   if ($findtok(%-ial.update,$1,32) != $null) { .timer 1 5 _blackscan $1 | halt }
  520.   if ($me !isop $1) halt
  521.   if ($_not(%+blackscan.hide)) dispr $1 [[ $+ %col.info1 $+ $1 $+ ] Performing blacklist scan...
  522.   unset %.bs.found %.+bs.did.*
  523.   set %.bs.num $nick($1,0)
  524.   :loop
  525.   set %.bs.nick $nick($1,%.bs.num)
  526.   if (%.bs.nick == $me) goto next
  527.   set %.bs.addr $maddress($address(%.bs.nick,5))
  528.   if (%.+bs.did. [ $+ [ %.bs.addr ] ] ) goto next
  529.   set %.+bs.did. [ $+ [ %.bs.addr ] ] $true
  530.   set %.bs.lvl $level(%.bs.addr)
  531.   if (black isin %.bs.lvl) {
  532.     set %.bs.chn $_ppblk(%.bs.addr)
  533.     if ($1 isin %.bs.chn) set %.bs.chn $1
  534.     elseif (* isin %.bs.chn) set %.bs.chn *
  535.     else goto next
  536.     set %.bs.why %.bs.addr $+ > $+ %.bs.chn
  537.     if (%.bs.chn == *) set %.bs.chn $_s2f(all channels)
  538.     if (%autounban.black > 0) tunban $calc(%autounban.black * 60) $1 %.bs.addr
  539.     kb $1 %.bs.addr $_blackmsg(Kicks,Blacklist,%.bs.chn,%.bs.nick,%.bs.addr,$_ppblk(%.bs.why))
  540.   }
  541.   :next
  542.   if ($_vd(.bs.num) > 0) goto loop
  543.   if (%.bs.found > 0) dispr $1 [[ $+ %col.info1 $+ $1 $+ ] %col.target $+ %.bs.found $+  blacklisted users found.
  544.   elseif ($_not(%+blackscan.hide)) dispr $1 [[ $+ %col.info1 $+ $1 $+ ] No blacklisted users found.
  545. }
  546. ; -----------------------------------------------------
  547. ; Auto eggy password
  548. ; -----------------------------------------------------
  549. on 1:open:=:{
  550.   set %.num $comchan($nick,0)
  551.   if (%.num > 0) {
  552.     set %.addr $address($nick,5)
  553.     :loop1
  554.     set %.ch $comchan($nick,%.num)
  555.     set %.bots %autobot. [ $+ [ %.ch ] ]
  556.     if (%.bots == $null) goto next1
  557.     set %.bots $gettok(%.bots,1,32)
  558.     :loop2
  559.     set %.var autobot. $+ %.ch $+ . $+ %.bots
  560.     set %.mask % [ $+ [ %.var ] ]
  561.     set %.type $gettok(%.mask,2-,47)
  562.     set %.serv $gettok(%.mask,2-,36)
  563.     set %.mask $gettok($gettok(%.mask,1,47),1,36)
  564.     set %.serv $gettok(%.serv,1,47)
  565.     if (%.type != eggy) goto next2
  566.     if ((%.serv != $null) && (%.serv != %pp.net) && (%.serv !iswm $server)) goto next2
  567.     if (%.mask !iswm %.addr) goto next2
  568.     if ($nick !isop %.ch) goto next2
  569.     msg =$nick $_pwenc($_ppcfg(%.var,pw))
  570.     return
  571.     :next2
  572.     if ($_vd(.bots) > 0) goto loop2
  573.     :next1
  574.     if ($_vd(.num) > 0) goto loop1
  575.   }
  576. }
  577. ; -----------------------------------------------------
  578. ; Finding user after nick change
  579. ; -----------------------------------------------------
  580. on 1:ctcpreply:*:set %.iden $gettok($address,1,64) | if (%-+findping. [ $+ [ %.iden ] ] == $null) return | dispa New nickname for %col.target $+ %-+findpingn. [ $+ [ %.iden ] ] $+  is %col.att $+ $nick | set %-+findping. [ $+ [ %.iden ] ] | set %-+findpingn. [ $+ [ %.iden ] ] | set %.+disphalt $true | halt
  581. on 1:notice:*:?:set %.iden $gettok($address,1,64) | if (%-+findping. [ $+ [ %.iden ] ] == $null) return | dispa New nickname for %col.target $+ %-+findpingn. [ $+ [ %.iden ] ] $+  is %col.att $+ $nick | set %-+findping. [ $+ [ %.iden ] ] | set %-+findpingn. [ $+ [ %.iden ] ]
  582. ctcp 1:*:?:if (@ !isin $target) return | dispa Warning- %col.target $+ $nick $+  %col.att $+ may be trying to detect your new nickname (if you changed nicknames recently)
  583.